//
//  myView.m
//  JianShu
//
//  Created by 苗钧豪 on 16/8/1.
//  Copyright © 2016年 苗钧豪. All rights reserved.
//

#import "myView.h"

@implementation myView
- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        _imgArr = [NSArray arrayWithObjects:@"0",@"1",@"2",@"3",@"4", nil];
        _scrollview1 = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, 5 * self.bounds.size.width, 250)];
        _scrollview1.contentSize = CGSizeMake(9 *self.bounds.size.width, 0);
        for (int i = 0; i < 5; i ++) {
            UIImageView *imgview = [[UIImageView alloc]initWithFrame:CGRectMake(i * self.bounds.size.width, 0, self.bounds.size.width, 250)];
            imgview.image = [UIImage imageNamed:[NSString stringWithFormat:@"%@",_imgArr[i]]];
            [_scrollview1 addSubview:imgview];
        }
        
        _scrollview2 = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 255, 2 * self.bounds.size.width, 100)];
        _scrollview2.contentSize = CGSizeMake(2.5 *self.bounds.size.width, 0);
        for (int i = 0; i < 5; i ++) {
            UIImageView *imgview = [[UIImageView alloc]initWithFrame:CGRectMake(self.bounds.size.width / 3 * i, 0, self.bounds.size.width / 3 - 20, 100)];
            imgview.image = [UIImage imageNamed:[NSString stringWithFormat:@"%@",_imgArr[i]]];
            [_scrollview2 addSubview:imgview];
        }
        _btn = [UIButton buttonWithType:(UIButtonTypeSystem)];
        _btn.frame = CGRectMake(0, 355, self.bounds.size.width, 45);
        [_btn setTitle:@"随便搜索点什么东西" forState:(UIControlStateNormal)];
//        _btn.titleLabel.textColor = [UIColor blackColor];
//        _btn.backgroundColor = [UIColor redColor];
        [self addSubview:_scrollview1];
        [self addSubview:_scrollview2];
        [self addSubview:_btn];
        
    }
    return self;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
